from reportlab.lib import colors
from reportlab.graphics.shapes import *
from reportlab.graphics import renderPDF

data = [
(2013, 3,   59.7,    60.7,    58.7,      118.7,   119.7,   117.7),
(2013, 4,   62.3,    64.3,    60.3,      120.1,   121.1,   119.1),
(2013, 5,   64.9,    67.9,    61.9,      121.5,   123.5,   119.5),
(2013, 6,   67.9,    72.9,    62.9,      123.6,   126.6,   120.6),
(2013, 7,   70.8,    75.8,    65.8,      125.3,   129.3,   121.3),
(2013, 8,   73.8,    79.8,    67.8,      127.1,   131.1,   123.1),
(2013, 9,   76.9,    83.9,    69.9,      129.5,   134.5,   124.5),
(2013, 10,   78.5,    85.5,   71.5,      131.0,   137.0,   125.0),
(2013, 11,   79.1,    87.1,   71.1,      131.6,   138.6,   124.6),
(2013, 12,   80.5,    89.5,   71.5,      132.7,   140.7,   124.7)
        ]
drawing = Drawing(200, 150)
pred = [row[2]-40 for row in data]
high = [row[3]-40 for row in data]
low = [row[4]-40 for row in data]
times = [200*((row[0] + row[1]/12.0) - 2013)-110 for row in data]

drawing.add(PolyLine(zip(times, pred), strokeColor=colors.blue))
drawing.add(PolyLine(zip(times, high), strokeColor=colors.red))
drawing.add(PolyLine(zip(times, low), strokeColor=colors.green))
drawing.add(String(65, 115, 'Sunspots', fontSize=18, fillColor=colors.red))

renderPDF.drawToFile(drawing, 'report1.pdf', 'Sunspots')
